package cn.zjh.basic.config;

import cn.zjh.basic.inInterceptor.LoginInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
//替换以前的xml配置
@Configuration
public class MyWebConfig implements WebMvcConfigurer {

        @Autowired
        private LoginInterceptor loginInterceptor;
        @Override
        public void addInterceptors(InterceptorRegistry registry){
            registry.addInterceptor(loginInterceptor)
                    //拦截所有的请求
                    .addPathPatterns("/**")
                    .excludePathPatterns("/login/**","/user/*/register","/verifyCode/**","/shop/settlement","/fastdfs")
            .excludePathPatterns("/swagger-resources/**", "/webjars/**", "/v2/**", "/swagger-ui.html/**");
        }

}
